package com.stt.experiment.trynetty.buffer;

import com.stt.experiment.trynetty.constants.ErrorCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Setter
@Getter
@ToString
public class ResponseBuffer extends AbstractResponseBuffer {

    private static final long serialVersionUID = 3258217570661986319L;

    public ResponseBuffer(AbstractBuffer buffer, String dataString) {
        super(buffer, dataString);
    }

    public ResponseBuffer(String module, String cmd, String dataString) {
        super(module, cmd, STATUS_SUCCESS, "", null, dataString);
    }

    public ResponseBuffer(AbstractBuffer buffer, String info, ErrorCode code) {
        super(buffer, info, code != null ? code.getCode() : null);
    }

    public ResponseBuffer(String module, String cmd, String info, ErrorCode code) {
        super(module, cmd, STATUS_FAILED, info, code.getCode(), null);
    }

    public ResponseBuffer(AbstractBuffer buffer, String info, ErrorCode code, String dataString) {
        super(buffer, info, code != null ? code.getCode() : null, dataString);
    }

    public ResponseBuffer(AbstractBuffer buffer, int status, String info, ErrorCode code, String dataString) {
        super(buffer, status, info, code != null ? code.getCode() : null, dataString);
    }

    public ResponseBuffer(String module, String cmd, int status, String info, ErrorCode code, String dataString) {
        super(module, cmd, status, info, code != null ? code.getCode() : null, dataString);
    }

}